package com.erpanderp.wam.adm.view;

import java.io.Serializable;
import java.util.ArrayList;
import java.util.List;
import java.util.Map;
import javax.faces.bean.ManagedBean;
import javax.faces.bean.ViewScoped;
import javax.faces.event.AjaxBehaviorEvent;
import com.erpanderp.wam.ac.model.entity.travel.Logistics;
import com.erpanderp.wam.ac.model.service.travel.LogisticsDAO;
import com.erpanderp.wam.util.CommonLookup;

@ManagedBean
@ViewScoped
public class LogisticsBean implements Serializable{

	private static final long serialVersionUID = 1L;
	
	private Logistics logistics = new Logistics();
	private Map<String,String> travelModetMap = CommonLookup.getTravelTypesMap();
	
	private List<Logistics> logisticsList = new ArrayList<Logistics>();
	public String selectedLogisticsFor="";
	private String displayName="";
	private boolean detailsForLogistics; 
	LogisticsDAO logisticDAO =new  LogisticsDAO();
	
	
	public LogisticsBean() {
		// TODO Auto-generated constructor stub
	}
	public void travelModeChangeListener(AjaxBehaviorEvent e) {

		System.out.println("INSIDE VALUE CHANGE LISTENER=11====11="+selectedLogisticsFor);
		setDisplayName(selectedLogisticsFor);
		setDetailsForLogistics(true);
		logisticsList = logisticDAO.getLogisticsByLogistisType(selectedLogisticsFor); 
		
		
	}
	
	//GENERATE SETTERS AND GETTERS

	public String getDisplayName() {
		return displayName;
	}
	public void setDisplayName(String displayName) {
		this.displayName = displayName;
	}
	public Map<String,String> getTravelModetMap() {
		return travelModetMap;
	}


	public void setTravelModetMap(Map<String,String> travelModetMap) {
		this.travelModetMap = travelModetMap;
	}


	public Logistics getLogistics() {
		return logistics;
	}


	public void setLogistics(Logistics logistics) {
		this.logistics = logistics;
	}
	public String getSelectedLogisticsFor() {
		return selectedLogisticsFor;
	}
	public void setSelectedLogisticsFor(String selectedLogisticsFor) {
		this.selectedLogisticsFor = selectedLogisticsFor;
	}
	
	public boolean isDetailsForLogistics() {
		return detailsForLogistics;
	}
	public void setDetailsForLogistics(boolean detailsForLogistics) {
		this.detailsForLogistics = detailsForLogistics;
	}
	public List<Logistics> getLogisticsList() {
		return logisticsList;
	}
	public void setLogisticsList(List<Logistics> logisticsList) {
		this.logisticsList = logisticsList;
	}
}
